﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using TableInfo = ND.Tool.DB4CodeAuto.TableInfo;
using TableFieldInfo = ND.Tool.DB4CodeAuto.TableFieldInfo;

namespace AutoCode.Win
{
    public class MyTableInfo
    {
        public MyTableInfo(string tableName, string tableNote)
        {
            this.TableName = tableName;
            this.TableNote = tableNote;
        }
        /// <summary>
        /// 数据库表名
        /// </summary>
        public string TableName { get; set; }
        /// <summary>
        /// 表基本信息
        /// </summary>
        public string TableNote { get; set; }
    }

    public class OutTableInfo
    {
        public string OutTable { get; set; }
        public string TableFiled { get; set; }
    }

    public class SqliteModelInfo : TableInfo
    {
        public string ModelID { get; set; }

        public static List<SqliteModelInfo> ToList(IList<TableInfo> os)
        {
            var rs = new List<SqliteModelInfo>();
            foreach (var o in os)
            {
                var r = new SqliteModelInfo();
                r.Name = o.Name;
                r.Note = o.Note;
                r.Tables = o.Tables;
                rs.Add(r);
            }

            return rs;
        }
    }

    public class SqliteModelParamInfo : TableFieldInfo
    {
        public string DefaultValue { get; set; }
        public string ModelID { get; set; }
        public string ParamID { get; set; }

        public static List<SqliteModelParamInfo> ToList(IList<TableFieldInfo> os)
        {
            var rs = new List<SqliteModelParamInfo>();
            foreach (var o in os)
            {
                var r = new SqliteModelParamInfo();
                r.ColConvertType = o.ColConvertType;
                r.ColDbType = o.ColDbType;
                r.ColName = o.ColName;
                r.ColType = o.ColType;
                r.IsNullAble = o.IsNullAble;
                r.PropValue = o.PropValue;
                r.TableName = o.TableName;
                rs.Add(r);
            }

            return rs;
        }
    }
}
